package cn.java.threadmodel.producerconsumer.lockcondition;

import cn.java.threadmodel.producerconsumer.waitnotify.ProducerConsumerQueue;

/**
 * @author 小石潭记
 * @date 2021/12/18 10:00
 * @Description: 消费者线程
 */
public class Consumer implements Runnable {

    private ProducerConsumerQueue<Integer> queue;

    public Consumer(ProducerConsumerQueue<Integer> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            queue.get();
        }
    }
}
